Skip to content

Conversation

@liangpei-web
Copy link

No description provided.

@endel
Copy link
Member

endel commented May 30, 2025

Hi @liangpei-web, sorry for the delay to review your PR.

I don't feel comfortable maintaining a custom URL implementation inside the SDK just to support WeChat. I'd recommend using a global URL polyfill instead, like this one: https://www.npmjs.com/package/url-polyfill

Regarding the Uint8Array limitation, you should be able to monkey-patch the global WebSocket in your side to support it, like this:

const WebSocket_send = WebSocket.prototype.send;
WebSocket.prototype.send = function(data) {
    if (data instanceof Uint8Array) {
        WebSocket_send.call(this, data.slice().buffer);
    } else if (Array.isArray(data)){
        WebSocket_send.call(this, (new Uint8Array(data)).buffer);
    } else {
        WebSocket_send.call(this, data);
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants